Skip to content

Conversation

@nicolasstucki
Copy link
Contributor

Fixes #14696

@nicolasstucki nicolasstucki self-assigned this Apr 29, 2022
@nicolasstucki nicolasstucki requested a review from smarter April 29, 2022 15:27
case Typed(pat, _) => rec(pat)
case UnApply(_, _, pats) => pats.foreach(rec)
case pat: Bind =>
report.error(IllegalVariableInPatternAlternative(pat.symbol.name), pat.withSpan(pat.nameSpan))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come we need to check this here, isn't typedBind going to run on this tree later and produce the same error via https://github.com/lampepfl/dotty/blob/400427db21410b366e4d9b890d73cec15416b632/compiler/src/dotty/tools/dotc/typer/Typer.scala#L2141-L2142 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The context at that point lost the mode InPatternAlternative. Now I found out where that is happening and will push a better fix.

@smarter smarter assigned nicolasstucki and unassigned smarter Apr 30, 2022
@nicolasstucki nicolasstucki marked this pull request as ready for review May 4, 2022 08:10
We use typedExpr to type the contents of a quoted pattern. In that
case it must not have the Pattern mode mut should keep the
InPatternAlternative because it will be needed in the pattern located
in the splices.
@nicolasstucki nicolasstucki merged commit 6540ad9 into scala:main May 9, 2022
@nicolasstucki nicolasstucki deleted the fix-14696 branch May 9, 2022 13:36
@Kordyjan Kordyjan added this to the 3.2.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expr pattern match throws java.lang.VerifyError: Bad local variable type

3 participants